package com.hspedu.homework.homework07;

class Test {
    String name = "Rose";

    Test() {
        System.out.println("Test");//(1)Test
    }

    Test(String name) {//name-->john
        this.name = name;//这里将父类的this.name(rose)修改成john
    }

    public static void main(String[] args) {
        //1.new Demo()
        new Demo().test();//匿名对象
        new Demo("john").test();//匿名
    }
}
public class Demo extends Test {
    String name = "jack";
    Demo(){
        super();
        System.out.println("Demo");//(2)Demo
    }
    Demo(String s){
        super(s);
    }
    public void test(){
        System.out.println(super.name);//(3)super.name-->Rose (5)john
        System.out.println(this.name);//(4)this.name-->jack (6)jack
    }
}
